let count=function(resolve,reject){
    setTimeout(() => {
        console.log('hello');
        reject();
    }, 2000);
}

const p=new Promise(count);
 p.finally(()=>{console.log("finally1")}).then(()=>{console.log("ok")},()=>{
     console.log("then error");
 }).catch(()=>{
     console.log("catch error");
 }).finally(()=>{console.log("finally2")});